<?php 
// Lay cac thong so cau hinh chung
include "../../app_global.php";
// Lay cac hang so dung chung
include "../../const.php";
// Ham thuc hien lay ten file va hien thi noi dung
include "../../isa-lib/isa-function/isa_public_function.php";
require_once("../../isa-lib/nusoap/nusoap.php");
include "../../isa-lib/isa-function/prax.php";
// Kiem tra NSD da login hay qua timeout chua
include "../../test_login.php";
include "../../connect.php";
include "../../connect_ado.php";
// Khoi tao cac bien SESSION chua quyen modul, function cua NSD
include "../../init_session.php";
// Lay cac thong so cau hinh rieng cho chuc nang nay
include "../../onegate_function.php";
include "../receive/const.php";
include "../handle/const.php";
include "app_local.php";
include "const.php";
include_once $FOLDER_DEVEDIT_CLASS;
// Lay cac hang so cua chuc nang nay
if (!isset($_REQUEST['modal_dialog_mode'])) {
	include "../../dsp_header.php";
}else{
	include "../../dsp_modal_dialog_header.php";
}
?>
<script src="../../isa-lib/isa-js/isa_util.js" ></script>
<script src="../receive/js_record.js"></script>
<script src="../handle/js_record_handle.js"></script>
<script src="js_archives.js" ></script><?php
//echo $fuseaction . '<br>';
switch($fuseaction) {
	case "DISPLAY_ALL_RECORD_ARCHIVES";
		$v_fuseaction_onclick = "DISPLAY_ALL_RECORD_WORK";
		include "../record-lib/qry_all_recordtype_by_staff.php";		
		include "qry_all_record_for_archives.php";
		include "dsp_all_record_for_archives.php";
		
		break;
	case "DISPLAY_ALL_RECORD_ARCHIVES_DIALOG";
		$v_fuseaction_onclick = "DISPLAY_ALL_RECORD_WORK";
		include "../record-lib/qry_all_recordtype_by_staff.php";		
		include "qry_all_record_for_archives.php";
		include "dsp_all_record_for_archives.php";
		
		break;
	case "DELETE_RECORD";
	    include "act_delete_record_store.php";
		break;
	case "DISPLAY_SINGLE_RECORD_CONTENT";
		$v_title = CONST_RECORD_CONTENT_TITLE;
		include "../record-lib/qry_single_record.php";
		include "../record-lib/dsp_single_record.php";
		break;
	/////////////////////////////////////////////////////////
	//Them cac fuseaction ben handle vao
	case "DISPLAY_ALL_RECORD_WORK";
		include "../record-lib/qry_single_record.php";
		include "../handle/qry_all_record_work.php";
		include "../handle/dsp_all_record_work.php";
		break;
	case "DELETE_RECORD_WORK";
		include "../handle/act_delete_record_work.php"; 
		break;
	case "DISPLAY_SINGLE_RECORD_WORK";
		include "../record-lib/qry_single_record.php";
		include "../handle/qry_all_worktype.php";
		include "../handle/qry_single_record_work.php";
		include "../handle/dsp_single_record_work.php";
		break;
	case "UPDATE_RECORD_WORK";
		include "../handle/act_update_record_work.php";
		break;
	case "DISPLAY_ALL_RECORD_DOC";
		include "../record-lib/qry_single_record.php";
		include "../handle/qry_all_record_doc.php";
		include "../handle/dsp_all_record_doc.php";
		break;
	case "DISPLAY_SINGLE_RECORD_DOC";
		include "../record-lib/qry_single_record.php";
		include "../handle/qry_single_record_doc.php";
		include "../handle/dsp_single_record_doc.php";
		break;
	case "UPDATE_RECORD_DOC";
		include "../handle/act_update_record_doc.php";
		break;
	case "DELETE_RECORD_DOC";
		include "../handle/act_delete_record_doc.php"; 
		break;
	case "DISPLAY_SINGLE_IDEA";
		include "../handle/qry_single_idea.php";
		include "../handle/dsp_single_idea.php";
		break;
	case "DISPLAY_ALL_IDEA";
		include "../record-lib/qry_single_record.php";
		include "../handle/qry_all_idea.php";
		include "../handle/dsp_all_idea.php";
		break;
	case "UPDATE_IDEA";
		include "../handle/act_update_idea.php";
		break;
	case "DISPLAY_SINGLE_LICENSE";
		include "../handle/qry_single_license.php";
		include "../handle/dsp_single_license.php";
		break;
	case "UPDATE_LICENSE";
		include "../handle/act_update_license.php";
		break;
	case "DISPLAY_SINGLE_POST_LICENSE";
		include "../handle/qry_single_license.php";
		include "dsp_single_post_license.php";
		break;
	case "UPDATE_POST_LICENSE";
		include "act_update_post_license.php";
		break;
	//////////////////////////////////////////////////////////////////
	default:
		if (onegate_is_receiver_for_recordtype($v_staff_id,0,$_SESSION["recordtype"])){?>
			<script language="javascript">
				window.location = "../receive/index.php"
			</script><?php
		}elseif(
				(onegate_is_handler_for_recordtype($v_staff_id,0,$_SESSION["recordtype"]))
				){?>
			<script language="javascript">
				window.location = "../handle/index.php"
			</script><?php
		}elseif (onegate_is_handler_leader_for_recordtype($v_staff_id,0,$_SESSION["recordtype"])
			    ||onegate_is_approve_leader_for_recordtype($v_staff_id,0,$_SESSION["recordtype"])
				||onegate_is_handler_leader_first_time_for_recordtype($v_staff_id,0,$_SESSION["recordtype"])
				){?>
			<script language="javascript">
				window.location = "../approving/index.php?fuseaction=DISPLAY_ALL_RECORD_FOR_APPROVING"
			</script><?php
		}else{
			$v_detail_status_compare = " And ((C_CURRENT_STATUS = ''CAP_PHEP'' And C_DETAIL_STATUS = 51) Or (C_CURRENT_STATUS = ''TU_CHOI'')) ";
			$v_fuseaction_onclick = "DISPLAY_ALL_RECORD_WORK";
			include "../record-lib/qry_all_recordtype_by_staff.php";		
			include "qry_all_record_for_archives.php";
			include "dsp_all_record_for_archives.php";
			break;
		}
}
include "../../disconnect.php";
if (!isset($_REQUEST['modal_dialog_mode'])) {
	include "../../dsp_footer.php";
}else{
	include "../../dsp_modal_dialog_footer.php";
}?>